package cn.crm.controller;

import cn.crm.pojo.CstLinkman;
import cn.crm.service.BasDictService;
import cn.crm.service.CstLinkmanService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/CstLinkman")
public class CstLinkmanController {
    @Autowired
    private CstLinkmanService cstLinkmanService;
    @GetMapping("/{custNo}")
    public List<CstLinkman> getListByCustNo(@PathVariable String custNo){
        return cstLinkmanService.getListByCustNo(custNo);
    }
    @GetMapping("/LkmId/{lkmId}")
    public CstLinkman getByLkmId(@PathVariable String lkmId){
        return cstLinkmanService.getById(lkmId);
    }
    @PostMapping
    public Boolean add(@RequestBody CstLinkman cstLinkman){
        return cstLinkmanService.save(cstLinkman);
    }
    @DeleteMapping("/{lkmId}")
    public Boolean delete(@PathVariable String lkmId){
        return cstLinkmanService.removeById(lkmId);
    }
    @PutMapping
    public Boolean update(@RequestBody CstLinkman cstLinkman){
        return cstLinkmanService.updateById(cstLinkman);
    }
}
